import sqlite3
# 连接到SQLite数据库
# 如果数据库不存在，会自动在当前目录创建:
conn = sqlite3.connect('example.db')

# 创建一个Cursor对象并通过它执行SQL语句
cursor = conn.cursor()
# 创建表
cursor.execute('''CREATE TABLE IF NOT EXISTS links
                (
                    id INTEGER PRIMARY KEY AUTOINCREMENT,
                    date text, 
                    domain text, 
                    port INTEGER, 
                    name TEXT,
                    method INTEGER,
                    username TEXT,
                    password TEXT,
                    key_path TEXT,
                    project_path TEXT,
                    project_package_path TEXT,
                    project_package_path_remote TEXT,
                    docker_compose_path TEXT,
                    docker_image_name TEXT,
                    docker_container_name TEXT,
                    project_package_command TEXT
                )''')

# 创建表
cursor.execute('''CREATE TABLE IF NOT EXISTS items
                (
                    id INTEGER PRIMARY KEY AUTOINCREMENT,
                    name TEXT,
                    type INTEGER,
                    label TEXT,
                    val TEXT
                )''')

# 提交事务
conn.commit()
